%matplotlib inline
from ipywidgets import interactive
import matplotlib.pyplot as plt
import numpy as np
def read_data(path): # read binary file
with open(path, "br") as bf:
data = np.fromfile(bf, np.float64)
return data
def transform_data_to_matrix(data): # transform array of data to matrix
return
n - count of moleculs
a - count segment in the molecul
L - size of dimensional
T - temperature
We simulate a system of N rigid rods of length `, moving in a 2D volume A with periodic boundary conditions. Steric rod-rod interactions are represented by a segment model, i.e., each rod is partitioned into n equidistant segments. All segments from different rods interact with each other via a Yukawa potential [1]. The pair potential of two rods α and β, that have orientation unit vectors {ˆ uα, ˆ uβ} and are separated by the center-of-mass distance ∆rαβ, is given by
Here, U0 is the potential amplitude, λ the screening length, and
the distance between the ith segment of rod α and the jth segment of rod β, with li ∈ [−(l−λ)/2,(l−λ)/2] denoting the position of segment i along the symmetry axis of the rod α. The screening length λ defines the effective diameter of the segments. The ‘shape’ of a rod of length l is then determined by the aspect ratio [a = l/λ.]
# For example
n = 100
L = 9.78082e-05
count = 5
T = 302
path = "C:/Users/bohda/Documents/WorkinGermany/transform_system/potential_0.bin"
matrix_potential_0 = transform_data_to_matrix(path, 1000) # 1000 - size
#name_cmap = "Greens"
ax = sns.heatmap(matrix_potential_0, linewidth=0.5, cmap=name_cmap)
plt.gcf().set_size_inches(10,8)
plt.show()
Since we are interested in the collision-dominated dynamics in dense bacterial suspensions, we neglect thermal and intrinsic [2] fluctuations of the bacterial orientation and restrict our study to deterministic motions. With these simplifying assumptions, the equations of motion for the center-of-mass rα(t) and orientation ˆ uα(t) of an SPR are of first order in time and can be written in the compact form
path_grad_x = "C:/Users/bohda/Documents/WorkinGermany/transform_system/grad_x.bin"
path_grad_y = "C:/Users/bohda/Documents/WorkinGermany/transform_system/grad_y.bin"
matrix_grad_x = transform_data_to_matrix(path_grad_x, 1000) # 1000 - size
matrix_grad_y = transform_data_to_matrix(path_grad_y, 1000) # 1000 - size
#name_cmap = "Greens"
ax = sns.heatmap(matrix_grad_y, linewidth=0.5, cmap=name_cmap)
plt.gcf().set_size_inches(10,8)
plt.show()
#name_cmap = "Greens"
ax = sns.heatmap(matrix_grad_x, linewidth=0.5, cmap=name_cmap)
plt.gcf().set_size_inches(10,8)
plt.show()
import io
import base64
from IPython.display import HTML
video = io.open("C:/Users/bohda/Documents/WorkinGermany/transform_system/movenemt_of_original_system.avi", 'r+b').read()
encoded = base64.b64encode(video)
HTML(data='''
<video controls>
<source src="C:/Users/bohda/Documents/WorkinGermany/transform_system/movenemt_of_original_system.avi;base64,{0}" type="video/avi" />
</video>'''.format(encoded.decode('ascii')))